<template>
  <div>
    <h2>Music</h2>
    <p>{{num}}</p>
    <p>{{doubleNum}}</p>
  </div>
</template>


<script>
import {mapState,mapGetters} from "vuex"
export default {
  name:"Music",
  mounted() {
    const re = mapState(["num"])
    console.log(re)
    console.log(re.num.call(this))
  },
  //计算属性:使用mapState方法返回个一个键值对的num:fn()
  // computed:{
  //   num(){
  //     return this.$store.state.num
  //   },
  //   doubleNum() {
  //     return this.$store.getters.doubleNum;
  //   }
  // }
  computed:{
    ...mapState(["num"]),
    ...mapGetters(["doubleNum"])
  }
}
</script>


<style></style>